<%--
  Created by IntelliJ IDEA.
  User: suyuwei
  Date: 2018/5/23
  Time: 9:36
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/dgfp_39_hz/statics/bootstrap/css/bootstrap.css" />
    <link rel="stylesheet" href="${pageContext.request.contextPath}/dgfp_39_hz/statics/table/bootstrap-table.min.css" />
    <script type="text/javascript" src="${pageContext.request.contextPath}/dgfp_39_hz/statics/jquery-3.2.1.min.js"></script>

    <script type="text/javascript" src="${pageContext.request.contextPath}/dgfp_39_hz/statics/ajaxfileupload.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/dgfp_39_hz/statics/bootstrap/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/dgfp_39_hz/statics/table/bootstrap-table.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/dgfp_39_hz/statics/table/locale/bootstrap-table-zh-CN.min.js"></script>
    <script type="text/javascript">
        $(function(){
            $('#table').bootstrapTable({
                url: '${pageContext.request.contextPath}/xu_inspection/queryConditionPage',
                columns: [
                    {
                        checkbox:true
                    },{
                        field: 'xunId',
                        title: '任务编号'
                    },{
                        field: 'xunName',
                        title: '任务名称'
                    },
                    {
                        field: 'roleline_lx.xlid',
                        title: '巡检线路'
                    },{
                        field: 'oneGanId',
                        title: '起始杆号'
                    },{
                        field: 'endGanId',
                        title: '终止杆号'
                    },{
                        field: 'u_user.name',
                        title: '下发人 '
                    },
                    {
                        field: 'renWuType',
                        title: '任务状态',
                        formatter: function (value, row, index) {
                            if (value == 1) {
                                return "待分配";
                            }
                            if (value == 2) {
                                return "已分配";
                            }
                            if (value == 3) {
                                return "待执行";
                            }
                            if (value == 4) {
                                return "执行中";
                            }
                            return "已完成";
                        }
                     }, {
                        field: 'wanChengTime',
                        title: '完成时间 '

                    },{
                        field: 'ifOver',
                        title: '是否取消任务 ',
                        formatter: function (value, row, index) {
                            if (value == 1) {
                                return "是";
                            }
                            return "否";
                        }
                    },{
                        field : 'xx',
                        title : '操作',
                        formatter:function(value,row,index){
                            return "<a href='javascript:upd("+row.id+")'>查看</a>&nbsp;|&nbsp;<a href='javascript:upd(\"+row.id+\")'>分配任务</a>&nbsp;|&nbsp;<a href='javascript:del("+row.id+")'>修改</a>&nbsp;|&nbsp;<a href='javascript:upd(\"+row.id+\")'>取消</a>" ;
                        }
                      }],
                //
                showToggle:true,
                clickToSelect:true,
                singleSelect:true,
                toolbar:"#toolbar",
                method:'post',
                contentType:"application/x-www-form-urlencoded",
                showRefresh:true,
                showColumns:true,
                queryParamsType:'',
                queryParams:queryParams,
                height:360,
                pageList:[5,10,15],
                pageNumber:1,
                pageSize:5,
                pagination:true,
                sidePagination:'server'

            });
        }) ;
        function search(){
            var opt = $("#table").bootstrapTable('getOptions') ;
            var xunXianLuId = $("#xunXianLuId").val() ;
            var renWuType = $("#renWuType").val() ;
            var xiafaRen = $('#xiafaRen').val();
            var xunId = $("#xunId").val();
            $.post('${pageContext.request.contextPath}/xu_inspection/queryConditionPage',{'xunId':xunId,'xiafaRen':xiafaRen,'renWuType':renWuType,'xunXianLuId':xunXianLuId,'pageSize':opt.pageSize,'pageNumber':opt.pageNumber},function(data){
                //重新给table绑定数据
                $("#table").bootstrapTable("load",data) ;
            }) ;
        }

        function queryParams (params) {
            var temp = {  //这里的键的名字和控制器的变量名必须一直，这边改动，控制器也需要改成一样的
                'pageSize': params.pageSize,  //页面大小
                'pageNumber': params.pageNumber, //页码
                'roleline_lx.xlid':$("#xunXianLuId").val(),
                'renWuType':$("#renWuType").val(),
                'u_user.name':$("#xiafaRen").val(),
                'xunId':$("#xunId").val()
            };
            return temp;
        };

    </script>
</head>
<body>
<!--搜索面板-->
<div class="panel panel-default">
    <div class="panel-body">
        <form class="form-inline">
            <div class="form-group">
               任务编码：<input id="xunId" type="text" class="form-control">
            </div>

            任务状态:
            <select id="renWuType" class="form-control">
                <option value="-1">--请选择--</option>
                <option value="1">待分配</option>
                <option value="2">已分配</option>
                <option value="3">待执行</option>
                <option value="4">执行中</option>
                <option value="5">已完成</option>
            </select>
            下发人 ：
            <input id="xiafaRen" type="text" class="form-control" >

            线路编号：
            <input id = "xunXianLuId" class="form-control" type="text">
            <button onclick="search()" type="button" class="btn btn-default">查询</button>
        </form>

    </div>
</div>
<table id="table" data-classes="table table-hover"></table>
</body>
</html>
